//
//  YMTestReportNextTimeCell.m
//  YMMedical
//
//  Created by y s on 2023/7/21.
//

#import "YMTestReportNextTimeCell.h"

@interface YMTestReportNextTimeCell ()

@property (nonatomic, strong) UIImageView *imgvIcon;
@property (nonatomic, strong) UILabel *lblTime;

@end

@implementation YMTestReportNextTimeCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUI];
    }
    return self;
}

#pragma mark - UI methods
- (void)setUI{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contentView.backgroundColor = [UIColor clearColor];
    self.backgroundColor = [UIColor clearColor];
    
    UIView *vBg = [[UIView alloc] init];
    vBg.backgroundColor = STheme.D9;
    vBg.clipsToBounds = YES;
    vBg.layer.cornerRadius = [SFitUtil fit:8];
    [self.contentView addSubview:vBg];
    [vBg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo([SFitUtil fit:15]);
        make.right.mas_equalTo([SFitUtil fit:-15]);
        make.top.bottom.mas_equalTo(0);
    }];
    
    UIView *vCenter = [[UIView alloc] init];
    [vBg addSubview:vCenter];
    [vCenter addSubview:self.imgvIcon];
    [vCenter addSubview:self.lblTime];
    
    [vCenter mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.centerY.mas_equalTo(0);
        make.left.mas_greaterThanOrEqualTo([SFitUtil fit:10]);
    }];
    [self.imgvIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.left.mas_equalTo(0);
        make.size.mas_equalTo([SFitUtil fitSize:24 height:24]);
    }];
    [self.lblTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.imgvIcon);
        make.left.equalTo(self.imgvIcon.mas_right).offset([SFitUtil fit:10]);
        make.right.mas_equalTo(0);
    }];
    
}

#pragma mark - public methods
+ (CGFloat)getCellHeight{
    return [SFitUtil fit:54];
}
- (void)setNextDate:(NSString *)nextDate{
    self.lblTime.text = [NSString stringWithFormat:@"%@%@",KLanguage(@"next_cai_time_fix"),nextDate];
}


#pragma mark - Event Action


#pragma mark - setter and getter
- (UIImageView *)imgvIcon{
    if (_imgvIcon == nil){
        _imgvIcon = [[UIImageView alloc] init];
        _imgvIcon.image = [UIImage imageNamed:@"home_health_detail_next_time"];
    }
    return _imgvIcon;
}
- (UILabel *)lblTime{
    if (_lblTime == nil){
        _lblTime = [SThemeUtil boldLabel:KLanguage(@"next_cai_time_fix") color:STheme.H_D1 fontSize:14];
    }
    return _lblTime;
}

@end
